<?php

use wap\assets\PageAsset;
use wap\models\Categories;
use yii\widgets\LinkPager;

/* @var $this yii\web\View */
/* @var $data \wap\models\Products[] */

$this->title = 'Biffar Product';

PageAsset::register($this)->init([
    'css' => [
        'css/product.css',
    ],
]);
?>

<div class="page-body">
    <div class="topbar" style="background-image: url('img/inner-page/product.jpg')"></div>

    <div class="box partner-box">
        <div class="container">
            <div class="box-text">
                <p>Biffar可提供多种造型、颜色及抛光度的标准铜板供客户选择， 并可以接受订制化服务。</p>
            </div>
        </div>
    </div>

    <div class="container clearfix">
        <div class="sidebar">
            <h1>Product</h1>
            <h3>Biffar产品</h3>

            <div class="siderbar-nav">
                <ul>
                    <li><a href="<?= \yii\helpers\Url::to(['product/index']) ?>">全部</a></li>
                    <?php $navs = Categories::getNavs() ?>
                    <?php foreach($navs as $nav){ ?>
                        <li>
                            <?php if(isset($nav['childs'])){ ?>
                                <a class="nav-item" href="<?= $nav['url'] ?>"><?= $nav['name'] ?><span class="iconfont <?= $nav['active'] ? 'icon-minus' : 'icon-plus' ?>"></span></a>

                                <ul style="display: <?= $nav['active'] ? 'block' : 'none' ?>">
                                    <?php foreach($nav['childs'] as $child){ ?>
                                        <li class="<?= $child['active'] ?>"><a href="<?= $child['url'] ?>"><?= $child['name'] ?></a></li>
                                    <?php } ?>
                                </ul>
                            <?php }else{ ?>
                            <a href="<?= $nav['url'] ?>"><?= $nav['name'] ?></a>
                            <?php } ?>
                        </li>
                    <?php } ?>
                </ul>
            </div>
        </div>

        <div class="product-list">
            <ul>
                <?php foreach($data as $datum){ ?>
                    <li>
                        <a href="<?= $datum->getViewUrl() ?>" class="preview"><img src="<?= $datum->getPreviewUrl(256, 256, false) ?>" /></a>
                        <h3><?= $datum->name ?></h3>
                    </li>
                <?php } ?>
            </ul>
        </div>

        <div class="pager">
            <?= LinkPager::widget(['pagination' => $pager]) ?>
        </div>
    </div>
</div>
